package com.zw.yzk.kabu.model;

import com.zw.yzk.kabu.data.network.entity.CollectedExhibitionEntity;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/3/10.
 */

public class CollectedExhibitionMapper {

    @Inject
    public CollectedExhibitionMapper() {
    }

    public CollectedExhibitionModel transfer(CollectedExhibitionEntity.Exhibition exhibition) {
        CollectedExhibitionModel model = new CollectedExhibitionModel();
        model.setImage(exhibition.image);
        model.setCity(exhibition.city);
        model.setCheckTicketTime(exhibition.checkTicketTime);
        model.setId(exhibition.id);
        model.setLimited(exhibition.limited);
        model.setDistrict(exhibition.district);
        model.setIsBuyable(exhibition.isBuyable);
        model.setStartTime(exhibition.startTime);
        model.setEndTime(exhibition.endTime);
        model.setStopPurchaseTime(exhibition.stopPurchaseTime);
        model.setPurchaseTime(exhibition.purchaseTime);
        model.setRemark(exhibition.remark);
        model.setAddress(exhibition.address);
        model.setName(exhibition.name);
        model.setProvince(exhibition.province);

        return model;
    }

    public List<CollectedExhibitionModel> transfer(List<CollectedExhibitionEntity.Exhibition> exhibitionList) {
        List<CollectedExhibitionModel> modelList = new ArrayList<>();
        if (exhibitionList == null || exhibitionList.isEmpty()) {
            return modelList;
        }
        for (CollectedExhibitionEntity.Exhibition exhibition : exhibitionList) {
            modelList.add(transfer(exhibition));
        }
        return modelList;
    }
}
